package cn.moningxi.service.impl;

import cn.moningxi.bean.GoodsCategory;
import cn.moningxi.mapper.GoodsCategoryMapper;
import cn.moningxi.service.GoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsCategoryServiceImpl implements GoodsCategoryService {
    @Autowired
    GoodsCategoryMapper goodsCategoryMapper;

    @Override
    public List<GoodsCategory> getAll() {
        return goodsCategoryMapper.getAll();
    }

    /**
     * 获取子类的分类
     *
     * @param cid
     * @return
     */
    @Override
    public List<GoodsCategory> getChildCate(Integer cid) {
        return goodsCategoryMapper.getChildCate(cid);
    }

    /**
     * 根据id查询分类信息
     *
     * @param cid
     * @return
     */
    @Override
    public GoodsCategory queryById(Integer cid) {
        return goodsCategoryMapper.queryById(cid);
    }

    /**
     * 获取热门的分类 选购热点
     *
     * @return
     */
    @Override
    public List<GoodsCategory> getHotList() {
        return goodsCategoryMapper.getHotList();
    }

    @Override
    public List<GoodsCategory> getAllCategory() {
        return goodsCategoryMapper.getAllCategory();
    }

    @Override
    public List<GoodsCategory> getChildCategory(Integer categoryId) {
        return goodsCategoryMapper.getChildCategory(categoryId);
    }

    @Override
    public GoodsCategory selectCateById(Integer categoryId) {
        return goodsCategoryMapper.selectCateById(categoryId);
    }

    @Override
    public void updateCateInfo(GoodsCategory submitCategoryInfo) {
        goodsCategoryMapper.updateCateInfo(submitCategoryInfo);
    }

    @Override
    public void addCategory(GoodsCategory submitAddCategoryInfo) {
        goodsCategoryMapper.addCategory(submitAddCategoryInfo);
    }

    @Override
    public List<GoodsCategory> getCateList() {
        return goodsCategoryMapper.getCateList();
    }
}
